package com.mcxx.modules.miniSalvation.order.param;

import com.mcxx.modules.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.List;


@Data
public class RecheckParam extends BaseParam {
    @ApiModelProperty(value = "操作类型")
    private String operType;

    @ApiModelProperty(value = "地区")
    private String areaCode;

    @ApiModelProperty(value = "区县")
    private String countyCode;

    @ApiModelProperty(value = "姓名")
    private String fullname;

    @ApiModelProperty(value = "身份证号")
    private String idcard;

    @ApiModelProperty(value = "登记日期开始")
    private String recorddate;

    @ApiModelProperty(value = "登记日期结束")
    private String enddate;

    @ApiModelProperty(value = "核对状态")
    private String checkState;

    @ApiModelProperty(value = "办理状态")
    private String state;

    @ApiModelProperty(value = "业务状态")
    private String bizState;

    @ApiModelProperty(value = "办理状态-程序内部逻辑用")
    private String states;

    @ApiModelProperty(value = "登记开始日期")
    private String commitStartDate;

    @ApiModelProperty(value = "登记结束日期")
    private String commitEndDate;

    @ApiModelProperty(value = "审核确认开始日期")
    private String auditingStartDate;

    @ApiModelProperty(value = "审核确认结束日期")
    private String auditingEndDate;

    @ApiModelProperty(value = "核对开始日期")
    private String checkStartDate;

    @ApiModelProperty(value = "核对结束日期")
    private String checkEndDate;

    @ApiModelProperty(value = "当前日期")
    private String nowMonth;

    @ApiModelProperty(value = "复查标记，0 不是复查 1是复查")
    private Integer recheckFlag;
    @ApiModelProperty(value = "标准类型，1 城市标准 2 农村标准")
    private String  standType;
    
    @ApiModelProperty(value = "低保类型")
    private String familyObjectType;

    @ApiModelProperty(value = "公示状态")
    private String countyNoticeState;

    private List<String> idsList;

    public String getState() {
        if(StringUtils.isNotEmpty(this.states)) {
            return null;
        }
        return this.state;
    }

    public String getStates() {
        if (StringUtils.isNotEmpty(this.state)) {
            return null;
        }
        StringBuffer statesBuff = new StringBuffer();
        if (this.getUserLevel() <= 3) {
            statesBuff.append(OrderStatus.FINISH).append(",");
            statesBuff.append(OrderStatus.TOWN_REVOKE).append(",");
            statesBuff.append(OrderStatus.APPROVE_REFUSE).append(",");
            statesBuff.append(OrderStatus.NOT_AGREE);
        }
        if (this.getUserLevel() == 4) {
            statesBuff.append(OrderStatus.CANCEL_CHECK).append(",");
            statesBuff.append(OrderStatus.SENIOR_CHECK).append(",");
            statesBuff.append(OrderStatus.TOWN_REVOKE).append(",");
            statesBuff.append(OrderStatus.APPROVE_REFUSE).append(",");
            statesBuff.append(OrderStatus.FINISH);
        }
        this.setStates(statesBuff.toString());
        return this.states;
    }

    public static class OrderStatus{
        
        public static String INIT = "10";
        public static String NOT_CHECK = "20";
        public static String JD_NOT_CHECK = "21";
        public static String CANCEL_CHECK = "22";
        public static String HAD_CHECK = "30";
        public static String NOT_AGREE = "31";
        
        public static String SENIOR_CHECK = "40";
        
        public static String TOWN_REVOKE = "38";
        
        public static String APPROVE_REFUSE = "51";
        public static String FINISH = "99";
    }
}
